import { createRouter, createWebHistory } from 'vue-router'

// 懒加载页面组件 - 实现代码分割
const ChatWindow = () => import('../components/ChatWindow.vue')
const Login = () => import('../pages/Login.vue')
const Register = () => import('../pages/Register.vue')
const HealthRecord = () => import('../pages/HealthRecord.vue')
const AppointmentCalendar = () => import('../pages/AppointmentCalendar.vue')
const UserProfile = () => import('../pages/UserProfile.vue')
const Dashboard = () => import('../pages/Dashboard.vue')
const SymptomAssessment = () => import('../pages/SymptomAssessment.vue')
const HealthAnalytics = () => import('../pages/HealthAnalytics.vue')
const NotificationCenter = () => import('../pages/NotificationCenter.vue')
const ApiTest = () => import('../pages/ApiTest.vue')

const routes = [
  {
    path: '/',
    name: 'Dashboard',
    component: Dashboard
  },
  {
    path: '/chat',
    name: 'Chat',
    component: ChatWindow
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/register',
    name: 'Register',
    component: Register
  },
  {
    path: '/health',
    name: 'HealthRecord',
    component: HealthRecord
  },
  {
    path: '/appointment',
    name: 'AppointmentCalendar',
    component: AppointmentCalendar
  },
  {
    path: '/profile',
    name: 'UserProfile',
    component: UserProfile
  },
  {
    path: '/symptom',
    name: 'SymptomAssessment',
    component: SymptomAssessment
  },
  {
    path: '/analytics',
    name: 'HealthAnalytics',
    component: HealthAnalytics
  },
  {
    path: '/notifications',
    name: 'NotificationCenter',
    component: NotificationCenter
  },
  {
    path: '/api-test',
    name: 'ApiTest',
    component: ApiTest
  },
  {
    path: '/:pathMatch(.*)*',
    redirect: '/'
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router